<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        span{
            color: darkgray;
            padding-left: 10px;
        }
    </style>
</head>
<body>
    <input type="text" id="text"><span id="span"></span>
    <script>
        //输入框默认提示(鼠标经过显示提示，当获得焦点或输入内容时，提示消失)
        text.addEventListener('mouseenter',function(){
            var span = document.getElementById('span')
            span.innerHTML="亲,请您输入!"
            if(text.value!=''){
                span.innerHTML=''
            }
        })
        text.addEventListener('focus',function(){
            span.innerHTML=''
        })
    </script>
</body>
</html>